package com.yuanzi.base.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

import com.yuanzi.base.util.JSONUtils;
import com.yuanzi.base.util.ResultUtils;

@Aspect
@Component
public class HystrixAspect {

	@Around("execution(public * com.seentao..*AppController.*(..))")
	public Object hystrix(ProceedingJoinPoint proceedingJoinPoint) {
		try {
			return proceedingJoinPoint.proceed();
		} catch (Throwable e) {
			return JSONUtils.toJSONString(ResultUtils.getFallback(e));
		}
	}
}
